package stool.simplefactory;

/**
 * @author Felix YF Dong
 * @date 2021/5/2
 */
public class OperationFactory {

    public static Operation createOperate(String operate) throws Exception {

        Operation operation = null;
        switch (operate) {
            case "+":
                operation = new OperationAdd();
                break;
            case "-":
                operation = new OperationSub();
                break;
            default:
                throw new Exception("This algorithm is not supported at present.");
        }

        return operation;
    }
}
